/*
 * Encoder.h
 *
 *  Created on: 2012/01/01
 *      Author: nobnak
 */

#ifndef ENCODER_H_
#define ENCODER_H_

#include "IReadable.h"
#include "lame-3.99.3_libmp3lame/lame.h"

class Encoder: public IWritable<short>, public IReadable<unsigned char> {
public:
	Encoder(int samplerate, int brate, int maxNumSamples);
	virtual ~Encoder();
	// IWritable
	void write(short* data, int n);
	void end();
	// IReadable
	void pipe(IWritable<unsigned char> *dst);
private:
	 lame_t lame;
	 int mp3bufSize;
	 unsigned char *mp3buffer;
	 IWritable<unsigned char> *dst;
};

#endif /* ENCODER_H_ */
